//app.js
//var client = require('./vendor/client/index');
import util from './utils/util.js';
var config = require('./config');
App({
  onLaunch: function (options) {
    // 创建信道，需要给定后台服务地址
    wx.updateShareMenu({
      withShareTicket: true,
      success:function(e){
        console.log(e)
      }
    })
    console.log(options)
    if (options.shareTicket !== undefined){
      wx.getShareInfo({
        shareTicket: options.shareTicket,
        success: function (e) {
          console.log(e)
          var memberInfo = wx.getStorageSync('userInfo').memberInfo;
          var queryOptions = {
            'url': config.service.callShareLog,
            'data': { 
              session_key: memberInfo.session_key, 
              iv: e.iv, 
              data: e.encryptedData, 
              scene: options.scene,
              form_id: options.query.form_id
              },
            'method': 'post',
            success(res) {
              
            },
            fail(res) {
              
            }
          }
          util.request(queryOptions)
        }
      })
    }
  },
  util: util,
  //client: client,
  config: config,
  globalData: {
    userInfo: null,
    app_id:null
  }
})